package br.pucrio.inf.lac.konoha.hyuga.core.output;

/**
 * An Output Entry class for the core Output class.
 */
public class OutputEntry implements Comparable<OutputEntry> {
    protected OutputType type;
    protected long       timestamp;
    protected int        size;
    protected String     strContent;

    public OutputEntry() {}
    
    public OutputEntry(long timestamp, OutputType type) {
        this(timestamp, type, 0, "");
    }
    
    public OutputEntry(long timestamp, OutputType type, int size, String strContent) {
        this.type = type;
        this.size = size;
        this.timestamp  = timestamp;
        this.strContent = strContent;
    }
    
    @Override
    public int compareTo(OutputEntry otherEntry) {
        return (int) (this.timestamp - otherEntry.timestamp);
    }
    
    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append(timestamp).append(",");
        sb.append(type).append(",");
        sb.append(size).append(",");
        sb.append(strContent);
        return sb.toString();
    }
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Get and Sets
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public OutputType getType() {
        return type;
    }

    public void setType(OutputType type) {
        this.type = type;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public String getStrContent() {
        return strContent;
    }

    public void setStrContent(String strContent) {
        this.strContent = strContent;
    }

}